﻿
namespace TingSLsocket

open System
open System.Net
open System.Net.Sockets
open System.Diagnostics
open SocketExtend

module ServerSocketExtend =

    // ***************************** socket extension
    type Socket with
        member this.DisconnectAsyncSafe saea callback =
            invokeAsyncMethod this.DisconnectAsync callback saea

        member this.AcceptAsyncSafe (saea : SocketAsyncEventArgs) callback =
            saea.AcceptSocket <- null
            invokeAsyncMethod this.AcceptAsync callback saea

        member this.AsyncAccept()=
            Async.FromBeginEnd(this.BeginAccept,this.EndAccept)
        